package model;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Observable;

/**
 * Wetter-Model-Objekt
 * @author Bernd Taube
 * @author Jakobus Boettcher
 * @version 1.0
 *
 */
public class Model extends Observable {
 
	HashMap<String, String> airportList;
	ArrayList<CityModel> cityList;	
	ArrayList<WeatherModel> weatherList;
	
	
	/**
	 * retrieves airports from DB by country name
	 * @param country
	 */
	
	public void retrieveAirportsFromDB(CountryModel country){
		airportList = new HashMap<String,String>();
		System.out.println("retrieving airports for "+country.getName());
		/**
		 * filling airportList
		 */
		notifyObservers();
	}
	
	
	/**
	 * retrieves cities from DB by country name
	 * @param country
	 */
	
	public void retrieveCitiesFromDB(CountryModel country){
		cityList = new ArrayList<CityModel>();
		System.out.println("retrieving cities for "+country.getName());
		/**
		 * filling cityList
		 */
		notifyObservers();
		
	}
	
	
	/**
	 * retrieves weather from DB by city name
	 * @param country
	 */
	
	public void retrieveWeatherFromDB(CityModel city){
		weatherList = new ArrayList<WeatherModel>();
		System.out.println("retrieving weather for "+city.getName());
		/**
		 * filling weatherList
		 */
		notifyObservers();
		
	}
	
	
	/**
	 *  'get'-methods for the views
	 */
	
	/**
	 * provides HashMap of airport strings (should we need an airportmodel class?)
	 * @return HashMap<String, String>
	 */
	public HashMap<String, String> getAirports(){
		airportList = new HashMap<String,String>();
		return airportList;
	}
	
	
	/**
	 * provides ArrayList of CityModel objects
	 * @returnArrayList<CityModel>
	 */
	public ArrayList<CityModel> getCities(){
		cityList = new ArrayList<CityModel>();
		return cityList;
	}
	
	/**
	 * provides ArrayList of WeatherModel objects
	 * @return ArrayList<WeatherModel>
	 */
	public ArrayList<WeatherModel> getWeather(){
		weatherList = new ArrayList<WeatherModel>();
		return weatherList;
	}
	
    @Override
    public void notifyObservers() {
        setChanged();
        notifyObservers(this);
    }
}